var user_monitoring =  {
		getUserList : function() {
			var  crid = sessionStorage.getItem("crid");
			$.ajax({
				type : "GET",
				url : "http://127.0.0.1:8080/yl-websocket/transmit?param='m=lookup&address=http://103.37.166.4:7777/StateGrid/ua.do",
				scriptCharset: 'utf-8', 
				success : function(param) {
					param = JSON.parse(param);
					user_monitoring.createUserList(param.data);
					user_monitoring.getClassRoom();
					user_monitoring.users = param.data;
				},
				error: function(){
				}
				
			});
		},
		createUserList : function(users){
			var str = '<p>未进入演讲室列表：</p>';
			for(var i in users){
				if(users[i].user_crid == 'notJoinAnyClassRoom'){
					str += '<div class="touxiangpic"><p>'+users[i].user_info.su_name+'</p></div>'; 
				}
			}
			str += '</div>';
			$("#userList_out").html(str);
		},
		getClassRoom : function(){
			var suid = JSON.parse(sessionStorage.getItem("suid")).data.su_id;
			$.ajax({
				type : "GET",
				url : "http://127.0.0.1:8080/yl-websocket/transmit?param='m=getclassrooms,suid="
						+ suid
						+ "&address=http://103.37.166.4:7777/StateGrid/cra.do",
				scriptCharset : 'utf-8',
				success : function(param) {
					param = JSON.parse(param).data;
					user_monitoring.createClassRoom(param);
				},
				error : function() {
				}
			});
		},
		createClassRoom : function(classRooms){
			var str = "";
			var j = 0;
			for(var i in classRooms){
				if(classRooms[i].isDel!="1"){
					j++;
					if(i == "0"){
						str += '<li class="active"><p onclick="user_monitoring.createRoomUsers(\''+classRooms[i].ecdClassRoomId+'\',this)">'+j+'、'+classRooms[i].projectName+'</p><div class="Monitbtn">清除所有用户</div></li>';
						user_monitoring.createRoomUsers(classRooms[i].ecdClassRoomId);
					}else{
						str += '<li class=""><p onclick="user_monitoring.createRoomUsers(\''+classRooms[i].ecdClassRoomId+'\',this)">'+j+'、'+classRooms[i].projectName+'</p><div class="Monitbtn">清除所有用户</div></li>';
					}
				}
			}
			$("#MonitUl").html(str);
			
		},
		createRoomUsers : function (id,u){
			if(u != null){
				$(u).parent().toggleClass('active').siblings().removeClass('active');
			}
			var str1 = "";
			var str2 = "";
			for(var i in user_monitoring.users){
				if(user_monitoring.users[i].user_crid != "notJoinAnyClassRoom" && user_monitoring.users[i].user_info.su_sr_id == "30" && user_monitoring.users[i].classroom_info.ecdClassRoomId == id){
					str1 += '<div class="yanjiang"><p>'+user_monitoring.users[i].user_info.su_name+'</p></div>';
				}else if(user_monitoring.users[i].user_crid != "notJoinAnyClassRoom" && user_monitoring.users[i].user_info.su_sr_id == "50" && user_monitoring.users[i].classroom_info.ecdClassRoomId == id){
					str2 += '<div class="yonghu"><p>'+user_monitoring.users[i].user_info.su_name+'</p></div>';
				}
			}
			$(".userTop").html(str1);
			$(".userBottom").html(str2);
		},
		users : ""
		
	}